package com.example.helloworld;

import java.util.Scanner;

/**
 * ClassName: ScoreTest
 * Package: com.example.helloworld
 * Description:
 *
 * @Author guotingting
 * @Create 2025/4/21 9:43 AM
 * @Version 1.0
 */
public class ScoreTest {
    public static void main(String[] args) {
        System.out.println("请输入学生人数：");
        Scanner scanner = new Scanner(System.in);
        int count = scanner.nextInt();
        int[] scores = new int[count];
        int maxScore = scores[0];
        System.out.println("请输入" + count + "个学生的成绩：");
        for (int i = 1; i < count; i++) {
            scores[i] = scanner.nextInt();
            if (scores[i] > maxScore) {
                maxScore = scores[i];
            }
        }
        System.out.println("最高分：" + maxScore);

        char grade = 'F';
        for (int i = 0; i < count; i++) {
            if (scores[i] >= maxScore - 10) {
                grade = 'A';
            } else if (scores[i] >= maxScore - 20) {
                grade = 'B';
            } else if (scores[i] >= maxScore - 30) {
                grade = 'C';
            } else {
                grade = 'D';
            }
            System.out.println("student" + i + "的成绩：" + scores[i] + "，等级：" + grade);
        }
        scanner.close();
    }
}
